<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>JpetStore后台管理</title>
    <link rel="stylesheet" href="../../css/backstage.css" type="text/css"/>
    <script th:src = "@{/JS/jquery-3.2.1.js}"></script>
    <script th:src = "@{/JS/jquery-ui.js}"></script>
</head>
<body>
<div th:replace="/administrator/common/head.html"></div>
<div class="mid">

    <form action="/order/AdminUpdateOrder" method="post" id="editItemTable">
        <div>
            <a href="/order/adminViewOrder">返回到订单信息(记得保存修改)</a>
        </div>
        <table>
            <tr>
                <td>订单编号:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getOrderId()}" name="orderId" readonly="readonly">
                </td>
            </tr>
            <tr>
                <td>完成时间:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getOrderDate()}" name="orderDate" readonly="readonly">
                </td>
            </tr>
            <tr>
                <td colspan="2">收件人信息:</td>
            </tr>
            <tr>
                <td>用户名:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getUserId()}" name="userId" readonly="readonly">
                </td>
            </tr>
            <tr>
                <td>Card Type:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getCardType()}" name="cardType" readonly="readonly">
                </td>
            </tr>
            <tr>
                <td>Card Number:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getCreditCard()}" name="creditCard" readonly="readonly">
                </td>
            </tr>

            <tr>
                <td>First name:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getBillToFirstName()}" name="billToFirstName">
                </td>
            </tr>
            <tr>
                <td>Last name:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getBillToLastName()}" name="billToLastName">
                </td>
            </tr>
            <tr>
                <td>Address 1:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getBillAddress1()}" name="billAddress1">
                </td>
            </tr>
            <tr>
                <td>Address 2:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getBillAddress2()}" name="billAddress2">
                </td>
            </tr>
            <tr>
                <td>Phone:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getPhone()}" name="phone">
                </td>
            </tr>
            <tr>
                <td>City:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getBillCity()}" name="billCity">
                </td>
            </tr>
            <tr>
                <td>State:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getBillState()}" name="billState">
                </td>
            </tr>
            <tr>
                <td>Zip:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getBillZip()}" name="billZip">
                </td>
            </tr>
            <tr>
                <td>Country:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getBillCountry()}" name="billCountry">
                </td>
            </tr>
            <tr>
                <td colspan="2">物流信息：</td>
            </tr>
            <tr th:if="${order.getDeliver() eq '1'}">
                <td>快递公司:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getFastmail()}" readonly="readonly">
                </td>
            </tr>
            <tr th:if="${order.getDeliver() eq '1'}">
                <td>快递编码:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getFastCode()}" readonly="readonly">
                </td>
            </tr>
            <tr th:if="${order.getDeliver() eq '1'}">
                <td>发货地址:&nbsp&nbsp&nbsp&nbsp</td>
                <td><input type="text"  style="width: 200px" th:value="${order.getShippingAddress()}" readonly="readonly">
                </td>
            </tr>
            <tr>
                    <table>
                        <tr>
                            <th>Item ID</th>
                            <th>Description</th>
                            <th>Quantity</th>
                            <th>Price</th>
                            <th>Total Cost</th>
                        </tr>
                        <tr th:each="cartItem:${arrayListCart}">
                            <td th:text="${cartItem.getItem().getItemId()}">
                            </td>
                            <td th:text="${cartItem.item.getAttribute1()+cartItem.item.getAttribute2+
                            cartItem.item.getAttribute3()+cartItem.item.getAttribute4()+cartItem.item.getAttribute5()+
                            cartItem.item.productId}"></td>
                            <td th:text="${cartItem.quantity}"></td>
                            <td th:text="${cartItem.item.listPrice}"></td>
                            <td th:text="${cartItem.getTotal()}"></td>
                        </tr>
                        <tr>
                            <th colspan="5" th:text="'Total:'+${order.getTotalPrice()}"></th>
                        </tr>
                    </table>
            </tr>
        </table>

        <input type="submit" style="font-size: 16px;" value="保存">
        <a th:href="@{'/order/deleteOrder?orderId='+${order.getOrderId()}}">删除该订单</a>


        <td th:if="${order.getDeliver() eq '0' && order.getisBuy() eq '1'}">
            <a th:href="@{'/order/confirmDeliver?orderId='+${order.getOrderId()}}">发货</a>
        </td>
        <td th:if="${order.getisBuy() eq '0'}">
            此订单未支付
        </td>
        <td th:if="${order.getisBuy() eq '1' && order.getDeliver() eq '1'}">
            订单已经发货
        </td>
    </form>
</div>
<div th:replace="/administrator/common/foot.html"></div>
</body>
</html>